from tkinter import ttk
import tkinter as tk
from typing import List, Callable


class Vertical(ttk.Frame):
    def __init__(
        self, master, children_callback: Callable[[tk.Tk], List[tk.Tk]] = None
    ):
        super().__init__(master)
        if children_callback is not None:
            for child in children_callback():
                self.add(child)

    def add(self, child):
        # for child in children:
        child.pack(side="top", fill="x")


class Horizontal(ttk.Frame):
    def __init__(
        self, master, children_callback: Callable[[tk.Tk], List[tk.Tk]] = None
    ):
        super().__init__(master)
        if children_callback is not None:
            for child in children_callback():
                self.add(child)
        # self.children = []

    def add(self, child, expand: bool = False, **kwargs):
        padx = 0
        if expand:
            child.pack(side="left", fill="both", expand=expand, **kwargs)
        else:
            child.pack(
                side="left",
                fill="y",
                # padx=padx,
                **kwargs
            )
